package com.hainabo.mgcmall.api.wx;

import com.hainabo.bootside.core.common.ReturnVO;
import com.hainabo.mgcmall.dao.SubscribeRespository;
import com.hainabo.mgcmall.model.Subscribe;
import com.hainabo.mgcmall.util.JsonUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Created by guoshihao on 2017/12/10.
 *预约
 */
@Api(value = "/wx/subscibe")
@Component
@Path("/wx/subscibe")
@Produces(MediaType.APPLICATION_JSON)
@Slf4j
public class WxSubscibeResource {
    @Autowired
    private SubscribeRespository subscribeRespository;

    @POST
    @Path("save")
    public ReturnVO save(String json){
        Subscribe subscribe = JsonUtil.toBean(json,Subscribe.class);
        return new ReturnVO(subscribeRespository.save(subscribe));
    }
}
